﻿#if WINDOWS_UWP || NETFX_CORE
using System.Globalization;

namespace System.ComponentModel
{
	[AttributeUsage(AttributeTargets.All)]
	public sealed class TypeConverterAttribute : Attribute
	{
		public static readonly TypeConverterAttribute Default = new TypeConverterAttribute();

		public TypeConverterAttribute()
		{
			typeName = string.Empty;
		}

		readonly string typeName;

		public string ConverterTypeName
		{
			get
			{
				return typeName;
			}
		}

		public TypeConverterAttribute(string typeName)
		{
			this.typeName = typeName;
		}

		public TypeConverterAttribute(Type type)
		{
			typeName = type.AssemblyQualifiedName;
		}

		public override bool Equals(object obj)
		{
			var attribute = obj as TypeConverterAttribute;
			return attribute != null && attribute.ConverterTypeName == typeName;
		}

		public override int GetHashCode()
		{
			return typeName.GetHashCode();
		}
	}
}
#endif